﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using YunCMS.Core;
using YunCMS.Common;
using YunCMS.Model;
using YunCMS.Core.Template;

namespace YunCMS.Web.Site
{
    public partial class Artical : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                var th = new TemplateHelper(Server.MapPath("~/templates/default/"));
                ArticalTemplate temp = new ArticalTemplate();
                string id = Request.QueryString["ID"];
                int _id = 0;
                if(!string.IsNullOrEmpty(id))
                {
                    if(!int.TryParse(id, out _id))
                    {
                        _id=1;
                    }
                }
               YCModuleArtical artical =  temp.GetItem(_id);
               th.Put("models", artical);
                string str = th.BuildString("artical.htm");
                Response.Write(str.Replace("\"images/", "\"/templates/default/images/").Replace("(images/", "(/templates/default/images/"));
                Response.End();
            }
        }
    }
}